// 给所有的函数添加一个xjhCall的函数
Function.prototype.xjhCall = function (thisArg, ...arg) {
  let fn = this;
  thisArg = thisArg ? Object(thisArg) : window;
  thisArg.fn = fn;
  const result = thisArg.fn(...arg);
  delete thisArg.fn;
  return result;
};

function num(num1, num2) {
  let ret = num1 + num2;
  console.log(this, ret);
  return ret;
}

let obj = {
  name: "xjh",
};
// let obj = "xjh";
// let obj = 123;
// let obj = true;
// let obj = null;

let ret = num.xjhCall(obj, 1, 2);
console.log(ret);
